package com.syxbyi.hmwk2.phone;

/**
 * （2）通话套餐类 特征：通话时长、短信条数、每月资费
 * 行为: 显示所有套餐信息
 * 让通话套餐类实现通话服务接口。
 */
public class CallPlan extends Plan implements CallService {
    private int airtime;            // 通话分钟数
    private int messageTotal;       // 短信条数

    /**
     * create a calling plan
     * @param name plan name
     * @param price price of plan
     * @param airtime length of call in plan
     * @param messageTotal total count of message in plan
     */
    public CallPlan(String name, double price, int airtime, int messageTotal) {
        super.name = name;
        super.price = price;
        this.airtime = airtime;
        this.messageTotal = messageTotal;
    }

    @Override
    public String toString() {
        return String.format("%s\n通话时长：%d分钟\n短信条数：%d", super.toString(), airtime, messageTotal);
    }

    @Override
    public void call(int length, SimCard card) {
        System.out.printf("通话长度：%d\n%s\n", length, card);
    }
}
